<?php
/*
 * @ https://EasyToYou.eu - IonCube v11 Decoder Online
 * @ PHP 7.2 & 7.3
 * @ Decoder version: 1.1.6
 * @ Release: 10/08/2022
 */

// Decoded file for php version 71.
namespace app\adminuser\model;

class AdminUser extends \app\BaseModel
{
    protected $name = "massage_admin_user";
    public function dataAdd($data)
    {
        $res = $this->insert($data);
        return $res;
    }
    public function dataUpdate($dis, $data)
    {
        $res = $this->where($dis)->update($data);
        return $res;
    }
    public function dataList($dis, $page)
    {
        $data = $this->where($dis)->order("id desc")->paginate($page)->toArray();
        return $data;
    }
    public function dataInfo($dis, $is_int = 0)
    {
        $data = $this->where($dis)->find();
        if(empty($data) && $is_int == 1) {
            $this->dataAdd($dis);
            $data = $this->where($dis)->find();
        }
        return !empty($data) ? $data->toArray() : [];
    }
    public function checkAuthData($data)
    {
        $auth = \longbingcore\permissions\AdminMenu::getAuthList((int) $data["uniacid"], ["adminuser"]);
        if($auth["adminuser"]) {
            $cap_dis[] = ["user_id", "=", $data["id"]];
            $admin = $this->where($cap_dis)->order("id desc")->find();
        }
        $arr["admin_user_status"] = !empty($admin) ? 1 : 0;
        return $arr;
    }
}

?>